package com.iisigroup.streetblock.vo;

/**
 * 街廓的VO
 * @author Ebi
 * @since 2015/01/13
 */
public class StreetBlockVO {
	
	public static final Integer TYPE_CITY = 1;
	public static final Integer TYPE_VILLAGE = 2;
	public static final Integer TYPE_NEIGHBORHOOD = 3;
	
	private String adm;
	private String county;
	private String city;
	private String village;
	private String road;
	private String neighborhood;
	private String section;
	private String sectionCh;
	private String lane;
	private String laneCh;
	private String alley;
	private String alleyCh;
	private String subAlley;
	private String subAlleyCh;
	private String numero;
	private Long weight;
	private Integer oddAndEven;
	
	/**
	 * 取得行政編號
	 * @return 行政編號
	 */
	public String getAdm() {
		return adm;
	}

	/**
	 * 設定行政編號
	 * @param adm 行政編號
	 */
	public void setAdm(String adm) {
		this.adm = adm;
	}

	/**
	 * 取得縣(市)
	 * @return 縣(市)
	 */
	public String getCounty() {
		return county;
	}
	
	/**
	 * 設定縣(市)
	 * @param county 縣(市)
	 */
	public void setCounty(String county) {
		this.county = county;
	}
	
	/**
	 * 取得市(鄉鎮區)
	 * @return 市(鄉鎮區)
	 */
	public String getCity() {
		return city;
	}
	
	/**
	 * 設定市(鄉鎮區)
	 * @param city 市(鄉鎮區)
	 */
	public void setCity(String city) {
		this.city = city;
	}

	/**
	 * 取得里(村)	
	 * @return 里(村)
	 */
	public String getVillage() {
		return village;
	}

	/**
	 * 設定里(村)
	 * @param village 里(村)
	 */
	public void setVillage(String village) {
		this.village = village;
	}

	/**
	 * 取得路	
	 * @return 路
	 */
	public String getRoad() {
		return road;
	}

	/**
	 * 設定路
	 * @param road 路
	 */
	public void setRoad(String road) {
		this.road = road;
	}

	/**
	 * 取得鄰
	 * @return 鄰
	 */
	public String getNeighborhood() {
		return neighborhood;
	}
	
	/**
	 * 設定鄰
	 * @param neighborhood 鄰
	 */
	public void setNeighborhood(String neighborhood) {
		this.neighborhood = neighborhood;
	}
	
	/**
	 * 取得段
	 * @return 段
	 */
	public String getSection() {
		return section;
	}
	
	/**
	 * 設定段
	 * @param section 段
	 */
	public void setSection(String section) {
		this.section = section;
	}
	
	/**
	 * 取得段(中文)
	 * @return 段(中文)
	 */
	public String getSectionCh() {
		return sectionCh;
	}

	/**
	 * 設定段(中文)
	 * @param sectionCh 段(中文)
	 */
	public void setSectionCh(String sectionCh) {
		this.sectionCh = sectionCh;
	}

	/**
	 * 取得巷
	 * @return 巷
	 */
	public String getLane() {
		return lane;
	}
	
	/**
	 * 設定巷
	 * @param lane 巷
	 */
	public void setLane(String lane) {
		this.lane = lane;
	}
	
	/**
	 * 取得巷(中文)
	 * @return 巷(中文)
	 */
	public String getLaneCh() {
		return laneCh;
	}

	/**
	 * 設定巷(中文)
	 * @param laneCh 巷(中文)
	 */
	public void setLaneCh(String laneCh) {
		this.laneCh = laneCh;
	}

	/**
	 * 取得弄
	 * @return 弄
	 */
	public String getAlley() {
		return alley;
	}
	
	/**
	 * 設定弄
	 * @param alley 弄
	 */
	public void setAlley(String alley) {
		this.alley = alley;
	}
	
	/**	
	 * 取得弄(中文)
	 * @return 弄(中文)
	 */
	public String getAlleyCh() {
		return alleyCh;
	}

	/**
	 * 設定弄(中文)
	 * @param alleyCh 弄(中文)
	 */
	public void setAlleyCh(String alleyCh) {
		this.alleyCh = alleyCh;
	}

	/**
	 * 取得衖
	 * @return 衖
	 */
	public String getSubAlley() {
		return subAlley;
	}

	/**
	 * 設定衖
	 * @param subAlley 衖
	 */
	public void setSubAlley(String subAlley) {
		this.subAlley = subAlley;
	}
	
	/**
	 * 取得衖(中文)
	 * @return 衖(中文)
	 */
	public String getSubAlleyCh() {
		return subAlleyCh;
	}

	/**
	 * 設定衖(中文)
	 * @param subAlleyCh 衖(中文)
	 */
	public void setSubAlleyCh(String subAlleyCh) {
		this.subAlleyCh = subAlleyCh;
	}

	/**
	 * 取得號
	 * @return 號
	 */
	public String getNumero() {
		return numero;
	}
	
	/**
	 * 設定號
	 * @param number 號
	 */
	public void setNumero(String numero) {
		this.numero = numero;
	}
	
	/**
	 * 取得權重(排序用)
	 * @return 權重(排序用)
	 */
	public Long getWeight() {
		return weight;
	}
	
	/**
	 * 設定權重(排序用)
	 * @param weight 權重(排序用)
	 */
	public void setWeight(Long weight) {
		this.weight = weight;
	}

	/**
	 * 取得單雙號
	 * @return {1:單, 2:雙}
	 */
	public Integer getOddAndEven() {
		return oddAndEven;
	}

	/**
	 * 設定單雙號
	 * @param oddAndEven {1:單, 2:雙}
	 */
	public void setOddAndEven(Integer oddAndEven) {
		this.oddAndEven = oddAndEven;
	}
	
	@Override
	public boolean equals(Object obj) {
		if (obj instanceof StreetBlockVO) {
			StreetBlockVO vo = (StreetBlockVO) obj;
			Integer count = 0;
			if (!this.getRoad().equals(vo.getRoad())) {
				count++;
			}
			
			if (!this.getNeighborhood().equals(vo.getNeighborhood())) {
				count++;
			}
			
			if (!this.getSectionCh().equals(vo.getSectionCh())) {
				count++;
			}
			
			if (!this.getLaneCh().equals(vo.getLaneCh())) {
				count++;
			}
			
			if (!this.getAlleyCh().equals(vo.getAlleyCh())) {
				count++;
			}
			
			if (!this.getSubAlleyCh().equals(vo.getSubAlleyCh())) {
				count++;
			}
			
			if (!this.getNumero().equals(vo.getNumero())) {
				count++;
			}
			
			if (count == 0) {
				return true;
			}
		}
		return false;
	}
	
	@Override
	public int hashCode() {
		return this.getLane().hashCode() + this.getNumero().hashCode();
	}

	@Override
	public String toString() {
		return "StreetBlockVO [adm=" + adm + ", county=" + county + ", city="
				+ city + ", village=" + village + ", road=" + road
				+ ", neighborhood=" + neighborhood + ", section=" + section
				+ ", sectionCh=" + sectionCh + ", lane=" + lane + ", laneCh="
				+ laneCh + ", alley=" + alley + ", alleyCh=" + alleyCh
				+ ", subAlley=" + subAlley + ", subAlleyCh=" + subAlleyCh
				+ ", numero=" + numero + ", weight=" + weight + ", oddAndEven="
				+ oddAndEven + "]";
	}

}
